package com.example.homework4;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RadioButton;

public class MainActivity extends AppCompatActivity {

    private EditText textUserName;
    private EditText textPassword;
    private EditText textChacked;
    private Button ButtonLogin;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.log_in);
        Log.i("MainActivityLife","调用onCreate()");

        textUserName = findViewById(R.id.editTextPhone);
        textPassword = findViewById(R.id.editTextTextPassword2);
        textChacked = findViewById(R.id.editTextTextPersonName);
        ButtonLogin = findViewById(R.id.button);
        //点击传递数据
        ButtonLogin.setOnClickListener(new View.OnClickListener(){
            public void onClick(View v){
                passDate();
            }
        });
    }

    //传递数据
    public void passDate(){
        Intent intent = new Intent(MainActivity.this,MainActivity2.class);
        intent.putExtra("name",textUserName.getText().toString().trim());
        intent.putExtra("password",textPassword.getText().toString().trim());
        intent.putExtra("cknumber",textChacked.getText().toString().trim());
        startActivity(intent);
    }




    @Override
    protected void onStart() {
        super.onStart();
        Log.i("MainActivityLife","调用onStart()");
    }

    @Override
    protected void onResume() {
        super.onResume();
        Log.i("MainActivityLife","调用onResume()");
    }

    @Override
    protected void onPause() {
        super.onPause();
        Log.i("MainActivityLife","调用onPause()");
    }

    @Override
    protected void onStop() {
        super.onStop();
        Log.i("MainActivityLife","调用onStop()");
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        Log.i("MainActivityLife","调用onDestroy()");
    }

    @Override
    protected void onRestart() {
        super.onRestart();
        Log.i("MainActivityLife","调用onRestart()");
    }

}